package jude.java.money.migrate;

import org.apache.commons.lang.StringUtils;

public class MigrateUtils {

	/** 根据标题获取产品的sku */
	public static String sku(String title) {
		return StringUtils.replaceChars(title, "'\"\\/<>?*\r\n\t:. &", "").toLowerCase();
	}
	
	/** 根据标题的代码(attribute code等) */
	public static String code(String title) {
		String c = title.replaceAll("[^\\w_]+", "_");
		c = c.replaceAll("^[_\\d]+", "");
		c = c.replaceAll("_+", "_");
		return c.toLowerCase();
	}
}
